package com.ruoyi.paip.client;

import com.dtflys.forest.annotation.Body;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Post;
import com.ruoyi.paip.domain.paip.ConditionData;
import com.ruoyi.paip.domain.paip.ModelConditionData;
import com.ruoyi.paip.domain.paip.ProductSearchData;
import com.ruoyi.paip.domain.paip.Response;

/**
 * TODO to describe PaipClient
 *
 * @author 辛凤文
 * @since 1.0
 */
public interface PaipClient {

    String URL_PAIP = "https://api.m.jd.com/api";
    String METHOD_GET = "GET";
    String METHOD_POST = "POST";
    String FUNCTION_ID_CATCH_CONDITION = "pp.own.channel.biz.index.catAndCondtion";
    String FUNCTION_ID_GET_CONDITION = "pp.own.channel.biz.index.aggCondition";
    String FUNCTION_ID_WECHAT_LIST = "pp.own.channel.biz.index.wechat.list";
    String FUNCTION_ID_PROMO_BATCH = "pp.own.channel.promo.batch";
    String FUNCTION_ID_ORDER_SUBMIT = "pp.inspect.yp.trade_order.submit";
    String FUNCTION_ID_ORDER_CONFIRM = "pp.inspect.yp.trade_order.confirm";
    String APP_ID_WX = "paipai_wx";
    String APP_ID_H5 = "paipai_direct_h5";

    /**
     * 获取所有商品分类/机型/条件
     */
    @Get(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_CATCH_CONDITION + "&appid=" + APP_ID_WX,
            headers = {
                    "referer: https://servicewechat.com/wx4987f0b3b115aae2/127/page-frame.html"
            }
    )
    Response<ConditionData> catchCondition();

    /**
     * 获取某机型条件选项
     */
    @Post(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_GET_CONDITION + "&appid=" + APP_ID_WX,
            headers = {
                    "referer: https://servicewechat.com/wx4987f0b3b115aae2/127/page-frame.html"
            }
    )
    Response<ModelConditionData> getCondition(@Body("body") String value);

    /**
     * 查询列表，搜索过滤
     * @param value searchFilter搜索条件
     * @return 物品列表
     */
    @Post(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_WECHAT_LIST + "&appid=" + APP_ID_WX,
            headers = {
                    "referer: https://servicewechat.com/wx4987f0b3b115aae2/127/page-frame.html"
            }
    )
    Response<ProductSearchData> list(@Body("body") String value);

    @Post(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_PROMO_BATCH + "&appid=" + APP_ID_WX,
            headers = {
                    "referer: https://servicewechat.com/wx4987f0b3b115aae2/127/page-frame.html"
            }
    )
    String promoBatch(@Body("body") String value);

    /**
     * 下单，提交订单
     * @param value 返回值
     * @return 物品列表
     */
    @Post(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_ORDER_SUBMIT + "&appid=" + APP_ID_H5,
            headers = {
                    "referer: https://paipai.m.jd.com/",
                    "cookie: __jdv=122270672%7Cdirect%7C-%7Cnone%7C-%7C1738925040492; __jdc=122270672; " +
                            "3AB9D23F7A4B3C9B=MDG3BV6FGBE7VBAGKDTR56ALUM5BAASQPOFN5ANU6FQZGDLOOYRNOM2B4Y5DJHVHQ5EJNZI6WDZBJDJ55ASSCFFOSI; language=zh_CN; cid=5; rurl=%2F%2Fwq.jd.com%2Fpinbind%2Fpintokenredirect%3Ftype%3D1%26biz%3Dhuishou%26rurl%3Dhttps%253A%252F%252Fpaipai.m.jd.com%252Fmine%252Forder%253Ftype%253D1%2526tag%253D-1%2526filter%253D1%252C2%252C6%2526from%253Dxcx_inspectwxapp%26scope%3D0%26sceneid%3D9001%26btnTips%3D%26hideApp%3D0; TrackID=32dINRkuioa51yFjQpXbVTimgrN9tQdzHolAG6VtTLaqIx24RqdR8Sd7HM8l1XHOXXFSSApzO-D2CR4Z5k8m5SZxg6SLQ2BNurETJnzxrstilH23-jikGxI70A5blFSwKAA5DUGTsz9rCxlelytYseOILzOAu7Z0NGfdB59rC6M; buy_uin=300000000023387255; jdpin=jd_66b89567df5ab; mcossmd=b2d7a3fdcc1093943bd06a96c2dc2882; nickname_base64=; open_id=oTGnpnPkJksCTI1VXqO-n5I3ew7I; openid2=E10D0EA46C3D23B90B69AB16E685150E68AAE74682096BD5E27E793714E102D3911BDC5B4A75AF70CB5C75385D39F39E; picture_url=; pinId=e1y1qeVHWacQgTwwYYJpNbV9-x-f3wj7; pinStatus=0; pinsign=069974f34e3fa7b0abe79b95cb474cad; sex=0; wq_skey=za9C4C33C4F33D8853AC816059A78D383D6F9D9609759B48F82A39ED7F7C43FC1BEE8241F28A91F2F2FFB5834E278E5A6EC5CEE20B85F295142FDFFEBF8945B2E34ECE04A2638D62F1C4BE87E1C3BE0EC458036C3DC564A8A19D74932D2CE30FAE; wq_uin=300000000023387255; wq_unionid=oCwKwuM1ukfsMfL3VidqpxxjV88U; wx_nickname=jd_user; country=; sfstoken=tk01wbc531bbea8sMisxKzIrMXgz41v5SVzMc8XPWKYU6XCTd826NoOCQbKwvE5iwnxlV7BSd8sj%2B1TITGLkMFKK3cX4; wq_auth_token=2B5698BE4B61A43BB7021FBBFEDC01DED9B9A33E94A22BA3F6CC31AB22080DD1B83F28FC0FCEF83361F49105C838CD66; pt_key=AAJnl3XVADCxg_3PUWKm-5sc3vlkEAje4cVDkRwA6rN8KlzQgxMPNCXTSGSBZ3skD4oJRieJkgU; pt_pin=jd_66b89567df5ab; pwdt_id=jd_66b89567df5ab; __jda=122270672.1738925040491252733418.1738925040.1738925040.1739095574.2; pt_st=1_K6efWWJI7AOqAxYKqunfbxXbas7BsSY6vMphDOLkQh8PdmGpanndmn1i9m3VrXPA69jEt_546ktEB5na7dZ-pzV3rprzMS7r0VfoDY6UbnKCfk5kJpZkHVNZDMB3IQD0BRRm-ttAeB8LAPnVbxWG8NIFle0Hy25T_m6ek55dN-tqzp9LuMnBebZjhVys0bXDw-QKP7N_eEPx4Qv88WAveR_7oIqGGG7njwWp_D4e; 3AB9D23F7A4B3CSS=jdd03MDG3BV6FGBE7VBAGKDTR56ALUM5BAASQPOFN5ANU6FQZGDLOOYRNOM2B4Y5DJHVHQ5EJNZI6WDZBJDJ55ASSCFFOSIAAAAMU5I3LE3QAAAAACE7CHIWWMRD6MAX; _gia_d=1; __jdb=122270672.10.1738925040491252733418|2.1739095574; sdtoken=AAbEsBpEIOVjqTAKCQtvQu17SZWwemEQ7DTu0WyGOrEsYVA6mXAWq_T0jYAiZWoHRSNoNYc2ij2bCtBLcqaTC4VNea9RO9xWI5A2ZAAtd2nnq40htWavb8chjkuUKLyu8yLljSGOGaqN9z6zG_Rh; mba_sid=1.10; mba_muid=1738925040491252733418.1.1739096269041; __jd_ref_cls=Settle_OrderConfirm"
            }
    )
    String submitOrder(@Body("body") String value);

    /**
     * 下单，确认订单
     * @param value 返回值
     * @return 物品列表
     */
    @Post(
            url = URL_PAIP + "?" + "functionId=" + FUNCTION_ID_ORDER_SUBMIT + "&appid=" + APP_ID_H5,
            headers = {
                    "referer: https://paipai.m.jd.com/",
                    "cookie: __jdv=122270672|direct|-|none|-|1738925040492; __jdc=122270672; " +
                            "3AB9D23F7A4B3C9B=MDG3BV6FGBE7VBAGKDTR56ALUM5BAASQPOFN5ANU6FQZGDLOOYRNOM2B4Y5DJHVHQ5EJNZI6WDZBJDJ55ASSCFFOSI; language=zh_CN; cid=5; rurl=%2F%2Fwq.jd.com%2Fpinbind%2Fpintokenredirect%3Ftype%3D1%26biz%3Dhuishou%26rurl%3Dhttps%253A%252F%252Fpaipai.m.jd.com%252Fmine%252Forder%253Ftype%253D1%2526tag%253D-1%2526filter%253D1%252C2%252C6%2526from%253Dxcx_inspectwxapp%26scope%3D0%26sceneid%3D9001%26btnTips%3D%26hideApp%3D0; TrackID=32dINRkuioa51yFjQpXbVTimgrN9tQdzHolAG6VtTLaqIx24RqdR8Sd7HM8l1XHOXXFSSApzO-D2CR4Z5k8m5SZxg6SLQ2BNurETJnzxrstilH23-jikGxI70A5blFSwKAA5DUGTsz9rCxlelytYseOILzOAu7Z0NGfdB59rC6M; buy_uin=300000000023387255; jdpin=jd_66b89567df5ab; mcossmd=b2d7a3fdcc1093943bd06a96c2dc2882; nickname_base64=; open_id=oTGnpnPkJksCTI1VXqO-n5I3ew7I; openid2=E10D0EA46C3D23B90B69AB16E685150E68AAE74682096BD5E27E793714E102D3911BDC5B4A75AF70CB5C75385D39F39E; picture_url=; pinId=e1y1qeVHWacQgTwwYYJpNbV9-x-f3wj7; pinStatus=0; pinsign=069974f34e3fa7b0abe79b95cb474cad; sex=0; wq_skey=za9C4C33C4F33D8853AC816059A78D383D6F9D9609759B48F82A39ED7F7C43FC1BEE8241F28A91F2F2FFB5834E278E5A6EC5CEE20B85F295142FDFFEBF8945B2E34ECE04A2638D62F1C4BE87E1C3BE0EC458036C3DC564A8A19D74932D2CE30FAE; wq_uin=300000000023387255; wq_unionid=oCwKwuM1ukfsMfL3VidqpxxjV88U; wx_nickname=jd_user; country=; sfstoken=tk01wbc531bbea8sMisxKzIrMXgz41v5SVzMc8XPWKYU6XCTd826NoOCQbKwvE5iwnxlV7BSd8sj%2B1TITGLkMFKK3cX4; wq_auth_token=2B5698BE4B61A43BB7021FBBFEDC01DED9B9A33E94A22BA3F6CC31AB22080DD1B83F28FC0FCEF83361F49105C838CD66; pt_key=AAJnl3XVADCxg_3PUWKm-5sc3vlkEAje4cVDkRwA6rN8KlzQgxMPNCXTSGSBZ3skD4oJRieJkgU; pt_pin=jd_66b89567df5ab; pwdt_id=jd_66b89567df5ab; __jda=122270672.1738925040491252733418.1738925040.1738925040.1739095574.2; pt_st=1_K6efWWJI7AOqAxYKqunfbxXbas7BsSY6vMphDOLkQh8PdmGpanndmn1i9m3VrXPA69jEt_546ktEB5na7dZ-pzV3rprzMS7r0VfoDY6UbnKCfk5kJpZkHVNZDMB3IQD0BRRm-ttAeB8LAPnVbxWG8NIFle0Hy25T_m6ek55dN-tqzp9LuMnBebZjhVys0bXDw-QKP7N_eEPx4Qv88WAveR_7oIqGGG7njwWp_D4e; mba_sid=1.9; 3AB9D23F7A4B3CSS=jdd03MDG3BV6FGBE7VBAGKDTR56ALUM5BAASQPOFN5ANU6FQZGDLOOYRNOM2B4Y5DJHVHQ5EJNZI6WDZBJDJ55ASSCFFOSIAAAAMU5I3LE3QAAAAACE7CHIWWMRD6MAX; _gia_d=1; __jdb=122270672.10.1738925040491252733418|2.1739095574; mba_muid=1738925040491252733418.1.1739096268495; sdtoken=AAbEsBpEIOVjqTAKCQtvQu17XFbdo_N-KEkENTSIbXSUBrTD4heFoW_gYHMe6ddteyvPSKjkNa0TRG5XSad_tOTHUqpYfZZEedxHNowgXVGjmjOT7c1Rh-v4oo9XU3DMjfWk_AQb0yKMTTVYE5gR"
            }
    )
    String confirmOrder(@Body("body") String value);


}
